Does “SHAttered” only work for PDF files?
The current version of the SHAttered website has an image that describes the structure of the attack, relative to the PDF.  I believe under fair use we can reproduce the image below:



So the collision blocks reside inside a JPEG image inside the PDFs.  JPEG file formats are a complicated topic, but modern software supports a variety of metadata in JPEGs—this is for example how cameras store the date and time that a photo was taken, the GPS coordinates where the photo was taken, camera settings that were used, pre-rendered thumbnails for quicker display at small resolutions, etc.  So you can create JPEGs that look exactly the same (same image data) but different metadata; and evidently you can also exploit this property to create JPEG files that look different but have the same SHA-1 digest.