Masks are powerful feature to output "IDs" for specific sets of objets and/or materials in order to separate these elements for some compositing (post) operation. For example, it is possible to separate foreground and background objects using masks in order to perform different colour grading operations on them.
In standard workflows, artists would manually assign IDs and colours to specific objects or materials (usually using the red, green and blue channels) in order to get these masks out. This is a tedious method that is completely superseded by the Multi-Masks feature presenting here.