The function of the extra compartments in the stomach of ruminant animals is to provide an area for their symbiotic bacteria to live.
In order to be able to digest cellulose which is the principal component of grasses, plant-eating mammals, otherwise known as ruminants, have extra stomach compartments.
These stomach compartments exist to make the digestion of cellulose easier through a symbiotic relationship with cellulose-digesting bacteria.
The compartments house these symbiotic bacteria and partially chewed plants are stored in them to facilitate digestion.
More on ruminant's digestion can be found here: https://brainly.com/question/21444343