What you are describing is a poor-man's form of patience diff.  Google it if unfamiliar.

Attached is a just slightly tweaked version I stole from bzr.  I have my emacs ediff-compare-program set to ~/bin/pdiff.

Being a python script it potentially may be a bit slow (though I have never had a problem).  An alternative I saw on stackoverlow would be to use git:

$ git diff --no-index --patience file1 file2

/john