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 not really a format, but is a collective name for PBM, PGM, and PPM.
PAM (portable arbitrary map) is a more sophisticated format which supports everything the PBM, PGM, and PPM formats do, and then some. PBM/PGM/PPM files could be considered to be valid PAM files, because programs that read PAM are also expected to read them.
The PBM, PGM, and PPM formats come in two varieties: a text format, and a binary format. PAM is binary-only.