Prolog (SWI), 7560 bytes
p([A,B],[BB]+[B,A]).
p([A,B,32|U],[B32|U]+[B,A,32|Y]):-p(U,Y)U+Y,!.
p([A|U],[A|Y])[A|U]+[A|Y]:-p(U,Y)U+Y.
Explanation
First we define the base case:
p([A,B],[B,A]).
This means that the last two letters will always be swapped.
Then we define what happens if we are right next to a space:
p([A,B,32|U],[B,A,32|Y]):-p(U,Y),!.
Two strings match if right before a space the letters before the space are swapped and the remainder if the strings match. We then use !
to cut.
Our last case is if we are not next to a space the first two letters need to match.
p([A|U],[A|Y]):-p(U,Y).