The ability to use a filter action to run or launch an external program, which are the available custom actions, would be difficult to use as a filter as you need. But there are some other options.
The easiest thing that you could do would be to use the new javascript custom search term. You could define some arbitrary javascript, which will return whether the message matches your criteria or not. Then you can setup a filter action to do whatever you want – trash, flag, etc. Or you could write your own custom search term, following the examples in the extension.
I'm not sure if the message body is going to be available to you though. There's a hook in the custom search term code that will delay the application of the custom search term until after the body is available, just like is done for the new IMAP body filter. But I have not tested it yet, so I don't know if it will actually allow access to the body, particularly because of the async nature of most body processing. But maybe.
If you were quite ambitious, you could write a custom component to override the existing junk mail plugin. That give you full async response possibilities, and is applied quite late in the message processing loop. But that is probably much more involved thatn you are looking at.