This article explains how to do that, how it works, and goes on a brief archaeological dig into the history of Mac OS. Giving special folders their own icon makes them more distinctive than simply applying a tag to them. You might have more than one copy of an app, or two different versions which by default use identical icons.
It’s sometimes valuable to be able to customise icons for folders and apps.