in reply to Comparing two text files and marking differences

Why reinvent the wheel? That's one hell of a lot of work when there's diff which is specifically for this task, and has been used around the world reliably since almost forever, and it does a heck of a lot more than just highlighting.