This is the entire reference grammar, referred to by other posts. Or rather, this will be the entire grammar, I will keep updating it until it is complete.

grammar tiff "TIFF 6.0 1992-06-03" tiff = tiff.header {endian tiff.bom} tiff.data tiff.header = {bytes 2} tiff.bom {bytes 2} tiff.version tiff.version = {endian tiff.bom} 42 tiff.bom = (0x49 0x49 {endian little} | 0x4d 0x4d {endian big}) tiff.data = ({bytes 4} offset {seek offset} ifd)* {bytes 4} 0 offset = (1|..|2^^32-1) ifd = {bytes 2} entries {sort ascending tag} entry[entries] entry = {bytes 2} tag {bytes 2} type {bytes 2} elems data type = (type_1B | type_2B | type_4B | type_8B | type_U) type_1B = (1 | 2 | 6 | 7) {_esize=1} type_2B = (3 | 8) {_esize=2} type_4B = (4 | 9 | 11) {_esize=4} type_8B = (5 | 10 | 12) {_esize=8} type_U = (0|13|..|65535) {_esize=0} data = data.small | data.big data.small = {?_esize <= 4} {bytes _esize} . {bytes 4-_esize} . data.big = {bytes 4} offset {seek offset} {bytes _esize} . tag = (Artist | BitsPerSample | CellLength | CellWidth | ColorMap | Compression | Copyright | DateTime | DocumentName | DotRange | ExtraSamples | FillOrder | FreeByteCounts | FreeOffsets | GrayResponseCurve | GrayResponseUnit | HalftoneHints | HostComputer | ImageDescription | ImageLength | ImageWidth | InkNames | InkSet | JPEGACTables | JPEGDCTables | JPEGInterchangeFormat | JPEGInterchangeFormatLength | JPEGLosslessPredictors | JPEGPointTransforms | JPEGProc | JPEGQTables | JPEGRestartInterval | JbCbCrSubSampling | Make | MaxSampleValue | MinSampleValue | Model | NewSubfileType | NumberOfInks | Orientation | PageName | PageNumber | PhotometricInterpretation | PlanarConfiguration | Predictor | PrimaryChromaticities | ReferenceBlackWhite | ResolutionUnit | RowsPerStrip | SMaxSampleValue | SMinSampleValue | SampleFormat | SamplesPerPixel | Software | StripByteCounts | StripOffsets | SubfileType | T4Options | T6Options | TargetPrinter | Thresholding | TileByteCounts | TileLength | TileOffsets | TileWidth | TransferFunction | TransferRange | WhitePoint | XPositiohn | XResolution | YPosition | YResolution | YbCbCrCoefficients | YbCbCrPositioning) NewSubfileType = 254 SubfileType = 255 ImageWidth = 256 ImageLength = 257 BitsPerSample = 258 Compression = 259 Compression.Uncompressed = 1 Compression.CCITT_1D = 2 Compression.Group_3_Fax = 3 Compression.Group_4_Fax = 4 Compression.LZW = 5 Compression.JPEG = 6 Compression.PackBits = 32773 PhotometricInterpretation = 262 PhotometricInterpretation.WhiteIsZero = 0 PhotometricInterpretation.BlackIsZero = 1 PhotometricInterpretation.RGB = 2 PhotometricInterpretation.RGB_Palette = 3 PhotometricInterpretation.Transparency_mask = 4 PhotometricInterpretation.CMYK = 5 PhotometricInterpretation.YCbCr = 6 PhotometricInterpretation.CIELab = 8 Thresholding = 263 CellWidth = 264 CellLength = 265 FillOrder = 266 DocumentName = 269 ImageDescription = 270 Make = 271 Model = 272 StripOffsets = 273 Orientation = 274 SamplesPerPixel = 277 RowsPerStrip = 278 StripByteCounts = 279 MinSampleValue = 280 MaxSampleValue = 281 XResolution = 282 YResolution = 283 PlanarConfiguration = 284 PageName = 285 XPositiohn = 286 YPosition = 287 FreeOffsets = 288 FreeByteCounts = 289 GrayResponseUnit = 290 GrayResponseCurve = 291 T4Options = 292 T6Options = 293 ResolutionUnit = 296 PageNumber = 297 TransferFunction = 301 Software = 305 DateTime = 306 Artist = 315 HostComputer = 316 Predictor = 317 WhitePoint = 318 PrimaryChromaticities = 319 ColorMap = 320 HalftoneHints = 321 TileWidth = 322 TileLength = 323 TileOffsets = 324 TileByteCounts = 325 InkSet = 332 InkNames = 333 NumberOfInks = 334 DotRange = 336 TargetPrinter = 337 ExtraSamples = 338 SampleFormat = 339 SMinSampleValue = 340 SMaxSampleValue = 341 TransferRange = 342 JPEGProc = 512 JPEGInterchangeFormat = 513 JPEGInterchangeFormatLength = 514 JPEGRestartInterval = 515 JPEGLosslessPredictors = 517 JPEGPointTransforms = 518 JPEGQTables = 519 JPEGDCTables = 520 JPEGACTables = 521 YbCbCrCoefficients = 529 JbCbCrSubSampling = 530 YbCbCrPositioning = 531 ReferenceBlackWhite = 532 Copyright = 33432