In the Salt system there are grains and pillars. I understand how I can assign custom grains, but when would it be better to consider using pillars?
In Salt, grains are used for immutable aspects of your minion, such as the cpu, memory, location, time zone, etc.
A pillar is a list of data on the master (in SLS format) that you need to distribute to your minions. Pillar allows you to set variables that the minions can access, for example a database configuration option.