Change Font Style when writing Code, Math, .. in Pages
What you’re looking for is called Character Styles. It works similarly to Paragraph Styles, except that it only affect the character you’ve selected. To create a paragraph style:


Select characters you want to define the style for (eg. math formula, code)  and change the background, font type, or font color according to your preferences.
Open up Text Inspector Pane (it’s under the same panel in Pages 5.x), or you might need to dig around for Pages 4.x. You should be able to see some default character styles such as ALL CAPS, Emphasis, and Underline. See screenshots.
From the list of styles, choose the + sign at the top right and name your newly created style. Apply this for all your future selected characters.


Here’s the screenshot for the list of Character Styles.