What does the yearly-anomalies command actually calculate?

Given the region and time period you have selected, it calculates a monthly climatology over the years you have selected and then subtracts these climatological values from the original values.

For gridded data, this calculation is done gridpoint by gridpoint. This command can only be used in conjuction with monthly data.