Yes, you can write your own rules. As examples, there are 2 expansion “packs” of addon rule plugins in the plugin manager plus some Rules from the Isotammi project.
You can design rules interactively (and without learning to build interface) with the SuperTool addon. Scrape the parameters of Filter gramplets into a Custom Filter using the Filter+ addon gramplet. (It can be illuminating to scrape the Filter+ parameters and look at the resulting custom filter code.) And easily visualize and change parameters of multi-stage Custom Filters with the FilterParams addon.
Also see:
- thread about addon Rule requests.
- the Gramps API documentation