An esophagram is a diagnostic imaging test that uses X-rays and a contrast material, usually barium, to visualize the esophagus and detect abnormalities such as strictures, tumors, or swallowing disorders. It provides detailed images that help in diagnosing conditions affecting the esophagus, making it a crucial tool in gastroenterology.