“But I have a few complaints against you. You tolerate some among you whose teaching is like that of Balaam, who showed Balak how to trip up the people of Israel. He taught them to sin by eating food offered to idols and by committing sexual sin. In a similar way, you have some Nicolaitans among you who follow the same teaching. Revelation 2:14-15 NLT
Not everyone in the church at Pergamum was faithful like Antipas. There were some who were teaching false doctrine and misleading the people.
The teaching of Balaam and that of the Nicolaitans are related. They both taught moral compromise regarding food sacrificed to idols and fornication.
Revelation gives us a few words that point us back to the Old Testament for the full story. Balaam refers to the story in Numbers 22-25 regarding Balak, king of the Moabites. He had hired Balaam to curse the Israelites so they would not have the power to conquer his land. However, Balaam was only able to bless and not curse. Balak then sent the Moabite women to entice the men of Israel into sexual immorality and to worship their gods, which they did.
There had been a meeting in Jerusalem regarding the Gentiles that were coming into the church. Acts 15:29 is a letter to the Gentiles to refrain from eating food sacrificed to idols and sexual immorality.
The Corinthians had the same problem of eating food that had been sacrificed to idols. They felt that they knew an idol didn’t mean anything, it was just a piece of stone or metal. Paul says they are to be an example to others. New Christians knew that eating food that was sacrificed to an idol meant you were worshiping the idol. If they saw a Christian eating it, they would think that they were also worshiping the idol. Paul wrote to the Corinthians that they were to be examples to those that were not that strong in the faith by abstaining from eating food that had been offered to idols. (See 1 Corinthians 8:4-13; 10:14-33.)
Rather, that the things which the Gentiles sacrifice they sacrifice to demons and not to God, and I do not want you to have fellowship with demons. 1 Corinthians 10:20 NKJV