You'll need to use rules & actions for that. When a user clicks to a modifier "Modifier Selected" rule fires. For example you can execute "remove last modifier" action in that rule if Total Modifier Count is greater than 2. That will cancel last selected modifier so user won't be able to choose more than 2 items. Additionally you can display a message or maybe you can just display a warning and let waiter decide.
As I can remember there was as long thread about this but I can't remember if it was in Turkish or English.