A compartment is a space within another space, like the glove compartment in a car.
Compartments are spaces, but they're not spaces that stand on their own. Rather, compartments are part of other spaces: they're subdivisions. The trunk is a compartment of a car. A pocket is a compartment of a suitcase. Closets are like compartments of rooms. One of the most common compartments is a car's glove compartment, where people throw all kinds of things. Anything that is divided into smaller spaces has compartments. The ventricles are like compartments of your heart.