How to compare and merge two xml files

I know this question has been asked multiple times and I have tried every alternative given in each of those questions but to no avial.

we have two teams working on two branches and merging the files is becoming a hassle. Git complains there is a conflict. Beyond compare does a line by line comparison and does not compare by each node.

  1. I have tried XDiff. It still does a line by line comparison. for Ex: line 10 has a tag <pattern id=200>, and xml2 has <pattern id =300> . It says there is a difference. However, pattern id = 200 is down the file at a different line number
  2. I have tried to sort xml nodes and then use beyond compare. Again not much help.

Any ideas or direction will help. I cannot use third party tools other than Beyond compare.