diff_match_patch

The Diff Match and Patch libraries offer robust algorithms to perform the operations required for synchronizing plain text.

diffmatchpatchdifference

https://code.google.com/p/google-diff-match-patch/