A reader who visited the Macworld forums would like a way to sort email based on flag color. He or she writes:
Would it be possible to create an Automator action that takes all email flagged with a specifically colored flag—blue, for example—and move it to a particular mailbox in Apple’s Mail? I’m running Lion on my MacBook Pro.
Regrettably, Automator is blind to flag colors in Mail. Mail’s rules are completely unaware of flags, which makes sense, given that rules are intended to act on email as it arrives and you flag messages after they’ve found their way to your Mac.

But yours is not a hopeless quest thanks to Mail’s Smart Mailboxes. Simply choose Mailbox -> New Smart Mailbox and in the resulting sheet use the pop-up menu to configure the condition to read Message Has Flag and then, from the color pop-up menu that appears, choose a color. Name the smart mailbox and click OK. Now, whenever you flag a message with a particular color, it will appear in the smart mailbox you just created.