ANSWER: The Bible verse you are referring to is in Matthew 7. This verse records Jesus stating we are not to offer holy things to dogs, nor are we to cast our pearls before swine, or else they might walk over them then afterwards come and attack us!
6. Do not give that which is holy to the dogs, nor cast your pearls before the swine, lest they trample them under their feet, and turn around and tear you in pieces (Matthew 7:6, HBFV)
The word "pearls" in Matthew 7 is symbolic of, or a metaphor for, godly wisdom and the salvation brought by his kingdom. God's wisdom, which all believers should strive to possess, is likened to something of a very great price in another reference in Matthew (see Matthew 13:45 - 46). All this is discussing God's kingdom and the wisdom one must acquire in order to enter it (see also Job 28:12 - 20).
Wisdom is found using the Holy Spirit, which is only given to those who obey him (Acts 5:32). However, how can understanding and knowledge lead us to our own pearls of great price (Matthew 13:45 - 46)? How can they bring us to the pure truth of God? It is only through recognizing and obeying his laws and his ways (Psalm 119:104).
God's precepts are written in the Holy Scriptures. If one has his Spirit, one can study his Word (His Precepts) for Holy knowledge, and upon this foundation of the Holy Spirit and Holy knowledge, the Eternal will then grant Holy understanding.
If we take our wisdom and throw it all around without knowing whether it might fall before dogs (an impure or self-righteous heart) or swine (someone who is considered unclean), Jesus warns us that they will likely tear us to pieces (they would twist and distort what is said then come after us).
God tells us in the book of Proverbs that there are times when we should be silent and times when we should respond directly to others (especially about God's truth). Jesus sometimes answered the questions and accusations thrown his way by the religious leaders of his day (e.g. Matthew 12:1 - 8) and sometimes refused to respond to their inquiries (e.g. Matthew 21:23 - 27).
We must discern the reason for any questions according to the person who is doing the asking and answer within that context (Proverbs 26:4 - 5). We should not cast our pearls of Godly wisdom before 'swine', meaning someone who is a militant, ready to fight, unbeliever lest they turn on us and insult us or do us harm.