The documentation has historically been lacking. It’s a bit better now, although some of the more obscure parts are still obscure - I have a lot of trouble with configuration resolution for example. But anyway, you could try looking at
and in particular for target naming: Build Target | Buck2
The essence of it all is staged computation. The first stage evaluates all the build files, which are written in Starlark (a pure subset of Python), and running these produces a graph of build rules. The implementation of each rule type is also written in Starlark, and the second stage evaluates the rules to produce an action graph: a graph of build actions where the edges are artifacts. This is what’s new about Buck 2 - in Buck 1 the rule implementations were written in Java in Buck itself, which made it really hard to modify and test any changes. In Buck 2 I can fiddle with the Haskell rules and get instant feedback. The language and API design rules out side effects in the BUCK files, and makes it really hard to write build code with untracked dependencies in the rule implementations.