Hi @bela
I think you want to have a look at this documentation:
http://www.advancedcustomfields.com/resources/register-fields-via-php/
You can create fields and fieldgroups dynamically with PHP using that API.
You can also create your own acf-json file as well and save in the theme if you prefer that.
http://www.advancedcustomfields.com/resources/local-json/