You need consider each unique line from your files as metachar, i.e. "character" for some expanded alphabet. By this way, both your files would be turned to "strings of metachars".
Mostly efficient way - to create hashtable, contains unique strings, and use indexes in the table as metachars.
Thereafter, you can search for minimal editing sequence between those strings by Levenshtein algorithm:
http://www.let.rug.nl/kleiweg/lev/levenshtein.html
http://en.wikipedia.org/wiki/Levenshtein_distance
http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance