How This Helps
The active components of peppermint oil are known to act on the muscle wall of the gastrointestinal tract. Menthol, menthone, cineol, and other volatile oils in peppermint oil relax the smooth muscles of the intestines owing to their antagonistic action on the calcium channels of the gut. 
Science and Research
Peppermint is one of the oldest traditional medicines and also one of the popular over-the-counter medicines for gastrointestinal troubles. A cross between watermint and spearmint, peppermint is a small perennial plant grown in various regions all over the world. Peppermint oil used for irritable bowel syndrome is extracted from the stem, leaves, and flowers of the plant. An antispasmodic and carminative (preventing formation or facilitating expulsion of gas) by nature, peppermint oil has good therapeutic action in irritable bowel syndrome.
Peppermint oil also reduces intestinal hypermotility and intragastric pressure mediated by the transient receptor potential channels. This in turn relieves symptoms like diarrhea with reduction in stool frequency, passage of mucus and gas, abdominal distension, and flatulence in irritable bowel syndrome. Menthol also shows an analgesic and anesthetic action on the central and peripheral nervous system relieving the chief symptoms of abdominal cramps, pain before and during defecation, and a feeling of incomplete evacuation following defecation.  Peppermint oil has been found to alleviate these symptoms of irritable bowel syndrome without much adverse reactions, making it safe for consumption.
The other active ingredients found chiefly in the leaves of the peppermint plant are phenolic constituents like rosmarinic acid, and several flavonoids like eriocitrin, luteolin, and hesperidin.  These elements possess a strong antimicrobial and antiviral action preventing secondary gastrointestinal infection common in patients with irritable bowel syndrome. The immunomodulatory and chemopreventive properties of peppermint oil alter the disease process of irritable bowel syndrome producing substantial relief of all the symptoms. 
Peppermint oil with its therapeutic properties has also been effective in improving the psychological component of depression and anxiety associated with IBS, making the overall quality of life better.
1. Peppermint oil for the treatment of irritable bowel syndrome: a systematic review and meta-analysis. Khanna R, MacDonald JK, Levesque BG. J Clin Gastroenterol. 2014 Jul;48(6):505-12. doi: 10.1097/MCG.0b013e3182a88357. Review.
2. A review of the bioactivity and potential health benefits of peppermint tea (Mentha piperita L.). McKay DL, Blumberg JB. Phytother Res. 2006 Aug;20(8):619-33. Review.
3. Pharmacology and preclinical pharmacokinetics of peppermint oil. Grigoleit HG, Grigoleit P. Phytomedicine. 2005 Aug;12(8):612-6. Review.
4. Peppermint oil (Mintoil) in the treatment of irritable bowel syndrome: a prospective double blind placebo-controlled randomized trial. Cappello G, Spezzaferro M, Grossi L, Manzoli L, Marzio L. Dig Liver Dis. 2007 Jun;39(6):530-6. Epub 2007 Apr 8.