Start by making a new Smart Playlist by selecting File > New Smart Playlist (or hold down the option key and click the gear that appears in the bottom left hand corner). You can select what you want from the drop-down menus in the middle section. For instance, I chose "Genre ... is ... Rock," but you can choose any of the options you want. Check the box next to "Limit ..." and type in how much storage your iPod or iPhone has, then select "GB" or "MB" from the next drop-down menu for Gigabytes and Megabytes. You also should make sure the "Live updating" checkbox is checked.
When you're done, click OK. You then need to make sure that you sync this and only this playlist to your iPod by going to your iPod (under devices) > Music, and select "Sync Music," and "Selected Playlists." Then put a check mark beside the playlist you just created. Re-sync, and you're done!
Want more tips and tricks like this? Visit TUAW's Mac 101 section today.