Student or Learner
1) We don't have to comply with the formality of eating at this restaurant. I don't even think they have any formality.
2) We don't have to be so formal when eating at this restaurant. I don't think there is anu formality in this restaurant.
#1 suggests that for some reason eating at this restaurant is considered something that must be done ('a formality'), but the speaker considers it unnecessary to do this. The second sentence would only make sense it it read, "I don't even think there is a 'formality'". 'Formality' in this sentence, used with 'comply with', suggests the countable noun that means 'a thing that you must do as a formal or official part of a legal process, a social situation, etc".
In #2, 'formality' is the uncountable noun meaning 'correct and formal behaviour'.
Definitions from the Oxford Advanced Learner's Dictionary, OUP.