The Netpbm formats are a set of uncompressed raster image file formats, associated with the Netpbm library and suite of image processing utilities.
PBM (portable bitmap) is a bi-level image format.
PGM (portable graymap) is a grayscale image format.
PPM (portable pixmap) is a color image format.
PNM (portable anymap) is a collective name for PBM, PGM, and PPM. A .pnm file may use any of those formats.
PAM (portable arbitrary map) is a more sophisticated format which supports everything the PBM, PGM, and PPM formats do, and then some. Some resources name this format "Portable Any Map", but that appears to be an error.
Each file begins with two ASCII characters, which serve as a signature.
The PBM, PGM, and PPM formats come in two varieties: a text ("plain") format, and a binary ("raw") format. PAM is binary-only.