Emacs (and probably Multiedit) do a good job highlighting differences.
As to deducing patterns and doing something about them - that's what programmers are paid to do. I don't think there will ever be an automated tool for that. When done by humans, it's called .... (drrum rrolll) .... refactoring!