As far as I know, nowadays the chess engines can judge that a move is the best or that it is brilliant (usually denoted by ! or !!). I was wondering what is the precise criterion for this classification.
Chess engines do not / cannot annotate moves. They evaluate positions. The annotations in game reviews from chess.com / lichess are generated in the following way: The engine evaluation of the position resulting from the move played is compared to the engine eval of the best move (according to the engine).
Depending on the evaluation change, inaccuracies,mistakes and blunders are marked, with different eval change thresholds for each category.
Note, that these thresholds are relative to the current evaluation, i.e. a move that turns a position from +0.3 to -2 will be marked as a blunder, but a change from +10.3 to +8 will not be marked as a blunder, even though there is the same absolute difference in evaluation. Therefore, these annotations are objective (w.r.t the used engine) and are straight-forward to generate.
The relativity of evaluation change is usually implemented using expected points instead of the raw engine evaluation, so that winning moves will not be marked as blunders. Each engine (centipawn) evaluation can be translated to expected points using the following formula:
winning chances = 50 + 50 * (2 / (1 + exp(-0.004 * centipawns)) - 1).
For example, an advantage of +1 (100 centipawns) translates to a 60% winning chance (or more precisely 0.6 expected points). The thresholds used at chess.com can be found here. Lichess also uses this model to annotate moves.
Strong and brilliant moves are much harder to define, and there are almost no chess sites except chess.com that implement this annotation.
On lichess, it is a much-requested feature, and thibault (the founder and main programmer of the site) tiredly asks: "What is a brilliant move?"
And he has a good point, as the ! and !! annotations denote human concepts of strong or unexpected moves. Engines do not know what type of moves are difficult to find for humans, and it is very difficult to conceptualize.
These annotations are much more subjective choices of an annotator.
It is very unlikely that automatic brilliant move annotations will ever come to lichess for that reason. Such automated annotations will miss many brilliant moves (e.g. unexpected silent moves).
The criterion at chess.com has changed multiple times due to ambiguity. Currently, they use the following classification of moves:
Move descriptors: Each of your moves fall into one of these categories
- Brilliant - This was a difficult to find sacrifice which put you in a great position!
- Great Move - This an important move that swings the course of the game, or is the only good move where any other move would have
been trouble. Great find!
- Best Move - The best move, according to the engine!
- Excellent - A great move, but not quite the best!
- Good - This move is okay, but could be better!
- Book - An established opening move
- Inaccuracy - This is a weak move that could be much better
- Mistake - A bad move that immediately worsens your position
- Blunder - A very bad move that could lose material or lose the game
- Missed win - A move was missed that would have won material, or won the game
So, chess.com chose to define a brilliant move (!!) as a (non-obvious) piece sacrifice that maintains the current evaluation of the position.
Brilliant (!!) moves and Great Moves are always the best or nearly best move in the position [...] A Brilliant move is when you find a good piece sacrifice. There are some other conditions, like you should not be in a bad position after a Brilliant move and you should not be completely winning even if you had not found the move.
Also, Chess.com defines a Great move (!) as a non-trivial move (i.e. not a simple recapture) that is the only move to maintain the current engine evaluation (i.e. is the best and the only good move).
Many of these moves would not be marked with ! or !! by human annotators.
Only one specific question remains: What exactly are "difficult" moves?
This is a proprietary assessment by chess.com and very unlikely to be disclosed for the reasons I have already outlined in this answer, as the notion of "difficult move" is likely used by their proprietary anti-cheat system.
Previously, chess.com had a more sophisticated algorithm for determining brilliant moves, but switched to this more comprehensible definition. The rumors regarding engine depth are not accurate.
Therefore, to finally answer the question:
What is the difference between a brilliant move and the best move?
A brilliant move is a special type of best move, that is a "good" piece sacrifice. (See above for conditions of "good")