For most simple GRUB settings, edit /etc/default/grub since it's a shell script that gets parsed by GRUB.
If you need to create new boot entries or tweak existing ones, add or modify scripts in /etc/grub.d. These scripts read from /etc/default/grub and generate the full configuration when you run update-grub (also known as grub-mkconfig).
The final configuration file where everything gets written is /boot/grub2/grub.cfg. You should never edit that file manually.