Diff is a standard utility from the Unix world outputting the differences between two files. Even if diff can handle binary files, it is used mostly to compare two versions of a text file. For mathematicians, diff is helpful for the comparison of $\LaTeX$ files written with co-authors, in particular via its graphical user interface tkdiff written in Tcl/Tk. If you use GNOME, you make take a look at meld. There is also diffpdf, which is very convenient to compare two versions of a PDF file. There is another well known utility called patch, a sort of reversed diff, used millions of times a day for software development, worldwide. On the technical side, diff relies on an algorithm for solving the longest common subsequence problem. By the way, if you are curious about text algorithms, you may take a look at the (free!) books written by Maxime Crochemore, from Marne-la-Vallée.