Using "himself" in a sentence
Use of the reflexive pronoun in such a way as seen in your quote from Conan-Doyle is a way of emphasizing the thing it refers to. As Wikipedia states:
Most of the time, reflexive pronouns function as emphatic pronouns that highlight or emphasize the individuality or particularity of the noun.
In other words, Moriarty is being cast as the benchmark of danger to Holmes, and stating that "the ghost of this scoundrel" by comparison was even a greater danger than that.
The meaning may not change, and the use of himself is not compulsory to get the idea across. But the emphasis is the important aspect you need to consider here.
In this sentence, is "himself" compulsory?
It depends on whoever you are submitting to.
Does the meaning change if it is removed?
Not really, though there will be a change in emphasis.
Or will there be a grammatical mistake if it is removed?
No, the sentence is still grammatical either way.
The use of himself isn't for grammar; it's more a matter of emphasis. It emphasises Professor Moriarty's (personal) threat to Sherlock Holmes.