I have 4 layers (A, B, C, D) which I wish to blend by the following formula (A xor B) plus (C xor D). Is it possible to accomplish this in Photoshop? I am a newbie and found that layer can only control it's blending with all underlying ones.
Maybe. Sort of.
The maths for blending modes probably doesn't fit exactly what you're after. Difference is the same as XOR, and I think Screen the closest you'll get to addition.
You should be able to set up the compositing you're after by setting a group blending mode.
If you're after specific and precise values as a result, you may be better served by using something else (or writing your own little application in a high level language).