It affects the air pressure inside the chest cavity by increasing or decreasing the space so it allows air to go in or out of the lungs.

4 3 4
When you breath in or inhale,the diaphragm muscle contrancts.inhaling moves the diaphgram down and expands the chest cavity. simultaneously,the ribs move up and increase the size of the chest cavitythere is now more space and less air preassure inside the lungs.air pushes in from the outside where there is higher air pressure.