All you need to do is, create a relationship between the 2 modules. Create a line item in Module B called 'List A' (Format: List ) and with the help of finditem() function derive the formula. If I understood correctly then your formula would be FINDITEM(LIST A, code(item(LIST B))).
Then use look up function to derive your end result. It should be IF PARENT_NODE = ModuleA.PARENT_NODE[lookup:list A] then "Similar" else "Different"