TNM staging is a system used to describe the extent of cancer in the ampulla of Vater, bile ducts, and pancreas based on the size of the original tumor (T), whether the cancer has spread to nearby lymph nodes (N), and whether the cancer has metastasized to distant organs (M).