It can be used when you need to configure something for the package specific to the machine where it is installed. It used to be used for installing binary dependencies, but since Julia 1.3 artifacts is used for that. There are lots of problems using it (relocability, reproducibility, …) so I would avoid it. There are better tools for this now (e.g. artifacts, scratch spaces).
See the docs Adding a build step to the package