Assuming you have the folders already set up, you have to create filters.
1. When a new message comes in, click on the message.
2. Select "Tools" from the menu bar.
3. Select "Create Filter From Message".
4. Select the option you wish to sort by, ie: "Filter on Subject", "Filter on Sender", etc.
Hope this helps.
Clark