Why JS specs call this a keyword and not a literal?
It more seems to be a literal, because we can use it as a value, or what am I missing?
return this
What is it then?
It doesn't really matter, but it's a keyword according to the specification: See Keywords and Reserved Words and Literals. The spec also uses the phrase "keyword this" in the text a fair bit, for instance (picking an instance at random), there's this text in the section on the abstract GetThisEnvironment operation:
...It determines the binding of the keyword
thisusing the LexicalEnvironment of the running execution context...
Earlier versions of the specification were quite explicit about it:
[From The ECMAScript 2019 Language specification]
11.6.2.1 Keywords
The following tokens are ECMAScript keywords and may not be used as Identifiers in ECMAScript programs.
Syntax
Keyword :: one of
awaitbreakcasecatchclassconstcontinuedebuggerdefaultdeletedoelseexportextendsfinallyforfunctionifimportininstanceofnewreturnsuperswitchthisthrowtrytypeofvarvoidwhilewithyield
(My emphasis.)
Continuing with your question:
It more seems to be a literal, because we can use it as a value...
I don't think there's any conflict between something being a keyword and producing a value when used in an expression. this is a keyword you can use to access the value of the ThisBinding of the environment record for the current execution context (or the nearest one that has one).
rici made a really good point in the comments: They said they don't think of this as a literal because unlike (say) true and false, it doesn't have a fixed value. Literals always have the same value, "a" is always "a", true is always true, null is always null, etc. But this has different values in different places in the code. It really acts more like a const than a literal; an implicit const set in the scope's environment object (or not, in the case of arrow function scope).
But again: It really doesn't matter. It's a reserved word that has a special purpose and function in the language, which seems sufficient that we needn't worry about whether it's a keyword or a literal (or both). :-)