What is HEIC?
What an iPhone saves photos as. It isn't really an image format so much as a container holding HEVC video frames - the same codec used for film, applied to one still. That gets a photo to about half the size of the equivalent JPG, and it's also why so little else opens one: HEVC is patent-licensed, so most browsers and a lot of desktop software can't read a HEIC at all. Big photos are usually stored cut into tiles that have to be reassembled.
What is PGM?
Greyscale, uncompressed, with a header you can read in a text editor. PGM is part of the netpbm family, and it exists because sometimes you want pixel values you can do arithmetic on without a decoder in the way. Image processing and computer vision code loves it.