you got a binary file and don't know its contents. Or some software creates binary files you have a specification for but don't want to decode them manually.
Synalyze It! allows you to create a grammar for binary files interactively. Unlike in regular hex editors or viewers the files are interpreted automatically for you!
The grammars are stored as XML files and contain all the structures that may occur in a file of a certain format, just like XML schemas. It's even possible to inherit structures from others (like in OO languages) so you don't have to repeat for example a length field that appears at the beginning of each structure.
Essentially it's a modeling tool for arbitrary file formats that is being used by software developers and data stream experts as well as in computer forensics.
Additionally Synalyze It! is a full-featured Hex Editor for the Mac allowing you to edit files of any size and interpret the bytes with dozens of text encodings.
For some well-known formats you can download grammars here. Matching grammars are suggested automatically when you open a file.
Right now you can download Synalyze It! for Mac OS X (Snow Leopard, Lion and Mountain Lion) and give it a try. In case of questions or problems please give me feedback. The latest changes can be tracked here; stay tuned also with Twitter.
If you like Synalyze It! consider buying the Pro version in the Mac App Store.
The Pro version has even more useful features.
See it in action on YouTube (Thanks, Aaron!)
In case you need a tool specialized in disk editing, I recommend to check out iBored.
2013-05-17: Version 1.5 available
2013-05-07: Updated Mach-O grammar for LC_DATA_IN_CODE (thanks, Cyril!)
2013-04-27: Added grammar to decode SCF DNA sequencing data
2013-04-03: Version 1.4 released
2013-03-03: Decode TIFF files with the new TIFF grammar
2013-02-13: Fallout GCD file format grammar provided by Alexander - thanks!
2013-01-27: Added grammars for shapefiles (vectorial maps)
2013-01-06: Grammar for Mobi and Kindle ebook formats
2013-01-03: New grammar for Infinity Engine BAM file format (thanks, Brad)
2013-01-02: Published manual: Synalyze It! User's Guide
2012-11-01: Wireshark PCAP packet grammar - thanks to Martin Janiczek
2012-10-26: STDF grammar provided by Joe Barnhart (Roos Inc.)
2012-07-04: Synalyze It! Pro 1.3 available in the Mac App Store
2012-04-20: Published grammar for Zelda Solarus DX saved games (Pascal)
2012-03-21: Added ACV grammar (thanks to Jonathan Wight)
2012-03-19: Added PVR grammar (thanks to Andreas Löw)
2012-02-22: Synalyze It! 1.2 released with many improvements
2012-02-22: Published grammar for Zj-Stream print files
2011-12-10: GraphViz export in Pro version 1.1.6 included
2011-11-19: Version 1.1.5 is now available
2011-11-07: Uploaded a grammar for CPF (Canon Preset Files) Thanks Chris!
2011-11-07: Uploaded grammars for Pokémon files - thanks, Kelvin!
2011-11-04: Published a grammar for ZIP files (needs version 1.1 - scripting)
2011-11-02: Synalyze It! Pro is available in the Mac App Store
2011-06-15: FLV files (Flash Video) can be decoded now
2011-05-13: A grammar for PCX image files is added
2011-04-14: A basic grammar for Audible files can be downloaded now
2011-04-08: A grammar for ICC (color) profiles is available now
2011-04-05: This is cool: Pascal Werz provided a grammar for Mach-O files.
2011-04-03: A grammar for saved games of Borderlands was added :)