Food when initially eaten goes into the rumen where it remains until it is brought back up in small plugs called cud.
This is done by moving back up through the eosophagus to the mouth where it is chewed using the back teeth and then returned to the rumen where it will sit and ferment unlocking nutrients.
Gas is formed as a result of this fermentation process and will be expelled as gas or "belching".