The feature is not yet available in Lightning experience.
the documentation says :
addError(errorMsg, escape)
Marks a trigger record with a custom error message, specifies whether or not the error message should be escaped, and prevents any DML operation from occurring.
Signature
public Void addError(String errorMsg, Boolean escape)
Parameters
errorMsg
Type: String
The error message to mark the record with.
escape
Type: Boolean
Indicates whether any HTML markup in the custom error message should be escaped (true) or not (false). This parameter is ignored in Lightning Experience and the Salesforce app and the HTML is always escaped. The escape parameter only applies in Salesforce Classic.
reference : https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_sobject.htm