How to sync 30 days of mail in the mail app?
You can't do this in the OS X Mail client. Mail.app will download all your emails available on the server.

The workaround is to make the change on the server. You mention that you have Gmail, therefore you can go to Gmail's IMAP settings and restrict the amount of emails available (for example, the most recent 1000).



Also, you can exclude labels from being visible to IMAP, therefore Mail won't download the contents.