If you have a Kaitai spec for the format, then its IDE[0] will do structural highlighting for you. This is web-based, but it doesn’t seem like too much of a stretch to implement a TTY version.
[1]: ide.kaitai.io