Iff you like Python, then mailprocessing¹ is a nice solution for this. You just write a small Python script to implement your rules:
for mail in processor:
if mail['X-Bugzilla-URL'].contains('zephyr-ds'):
mail.move('Zephyr')
elif ...
Given the layer it operates on you don't need to worry quite so much about processing errors dropping mails either.