While there is nothing like a runtime-plugin mechanism to add new output formats, the refdb code is sufficiently modularized to make the implementation of a new format a fairly easy task. You don't have to parse the query results directly, but you call wrapper functions instead. This also has the nice advantage that changes in the database design show up only in one place and thus are less likely to break the backend implementations.
We will first have a look at the API that backend.c provides. Then we'll have a look at those parts in the existing code that need to be modified in order to accept a new backend.