One thing to keep in mind about sqlite is that the 'database' is just a file on the file system, and you can use the 'sqlite3' tool to open up and poke around in any sqlite file.
Actually if you're trying to manipulate the data 'out of band', or make an external tool that acts on a program's data, then sqlite is a dream format since it gives you a very powerful structured data manipulation interface (the SQL language).
If you want to keep the data in version control, you can do a data dump from the database file into a text file and then check *that* into VCS:
echo ".dump" | sqlite3 grampsdb > my_gramps.sql
You can also do that, of course, and use your regex masher on that sql file, and then import it back into the database. ;)