You have stumbled across the use of es as a syntactical expletive.
German sentences (main clauses only; within the context of this answer unless otherwise mentioned) are split into three parts by their included verbs: the Vorfeld (preceeding a finite verb in second position), the Hauptfeld (between a finite verb in second position and infinitives or participles at the end) and the Nachfeld (anything following the last set of verbs). Consider this example:
Ich bin heute in die Stadt gegangen um einzukaufen.
The verbs responsible are bolded. The Vorfeld is occupied by ich, the Hauptfeld by heute in die Stadt and the Nachfeld by um einzukaufen.
Most German sentences will not have anything in the Nachfeld. However, almost all German sentence must include something in the Vorfeld. This is typically associated with the subject of a sentence or with something that requires emphasis. An empty Vorfeld will mark one of a very small class of phrases:
Imperatives; the verb must be first in these
Geh in die Stadt um einzukaufen!
Unmarked conditional clauses allow for a special construction:
Gehe ich in die Stadt, kaufe ich wahrscheinlich ein.
Which can be rewritten using a conditional subordinate clause in the following way:
Wenn ich in die Stadt gehe, kaufe ich wahrscheinlich ein.
(Note that the second main clause, kaufe ich wahrscheinlich ein has the first clause occupying its Vorfeld.)
Now sometimes, Germans don’t want to add emphasis to anything within a sencence and sometimes a sentence just naturally comes without a subject.[1] If that is the case and there is nothing to fill the Vorfeld, the sentence could be mistaken for a conditional clause. To prevent that, a syntactical expletive is added which merely fulfils the role of keeping the Vorfeld occupied in the absence of other candidates.
Es sind nicht alle gleich.
Es wird gefeiert.
(This second one is special, because aside from placing the past participle gefeiert into the Vorfeld there is nothing else that can go there; and ‘Gefeiert wird’ is not considered valid across all of Germany.)
In your case, the usage of the expletive is only due to reduce emphasis. There is nothing wrong with a sentence like:
Nicht alle sind gleich.
Gleich sind nicht alle.
Where the expletive disappears. Note that nicht alle is the sentence’s subject and hence the verb displays plural number.
A final note on your proposed alternative: the nicht is used to negate the alle in your example sentence. Thus, it must stay closely connected to alle. Putting them both into the Vorfeld is fine but separating them is not.