That is from the help. The full man page explains in more detail.
–rebuildtree
When installing an AUR package rebuild and reinstall all of its AUR dependencies recursively, even the ones already installed. This flag allows you to easily rebuild packages against your current system’s libraries if they have become incompatible.
--rebuildall - This rebuilds all AUR packages that would be installed by the yay command --rebuildtree - Same as above but also rebuilds all those packages dependencies
To be clear, --rebuildall doesn’t rebuild every AUR package you have installed in the system, just the ones that would be installed by the yay command.
If you are asking why use those options, it is because, sometimes, with an AUR package that is built from source, it needs to be rebuilt even when the package itself hasn’t been updated. This is happens when something it is built against is updated.