yes they are called git-merge drivers. https://git-scm.com/docs/gitattributes
I mentioned it before, see the following comment https://news.ycombinator.com/item?id=47749916
You can also use a custom difftool or mergetool that understand your formats. For example Beyond Compare https://www.scootersoftware.com/kb/moreformats