For filters I use Sieve [1] (comes with Cyrus Imap and I believe some others like Dovecot). There are a few plugins for roundcube that provide an interface for managing sieve rules [2], [3]. I tested both linked below and both worked, but they seem geared toward users who want a UI for rule creation, like in Gmail, whereas I have an existing sieve script I want to edit directly. Anyway, filter functionality is there in roundcube that's at least comparable to gmail, so long as your imap server supports sieve.
[1] http://en.wikipedia.org/wiki/Sieve_%28mail_filtering_languag... [2] http://trac.roundcube.net/browser/github/plugins/managesieve [3] http://www.tehinterweb.co.uk/roundcube/#pisieverules