The Generic Diff Format (GDIFF) can be used to efficiently describe the differences between two arbirary files. The format does not make any assumptions about the type or contents of the files, and thus can be used to describe the differences between text files as well as binary files. The GDIFF format is itself a binary file format.
Gemfile gem 'gdiff', '~> 0.0.3'
install gem install gdiff