This may be an ABBA doublet:
Do not give dogs what is holy,
and do not throw your pearls before pigs,
lest they [the pigs] trample them underfoot
and [the dogs] turn to attack you.
"Matthew"/Jesus was alluding to this passage of Torah:
ESV Exodus 22:29 You shall not delay to offer from the fullness of
your harvest and from the outflow of your presses. The firstborn of
your sons you shall give to me. Exodus 22:30 You shall do the same
with your oxen and with your sheep: seven days it shall be with its
mother; on the eighth day you shall give it to me. Exodus 22:31 You
shall be consecrated to me. Therefore you shall not eat any flesh that
is torn by beasts in the field; you shall throw it to the dogs.
Brenton LXX Exodus 22:29 Thou shalt not keep back the first-fruits of
thy threshing floor and press. The first-born of thy sons thou shalt
give to me. Exodus 22:30 So shalt thou do with thy calf and thy
sheep and thine ass; seven days shall it be under the mother, and the
eighth day thou shalt give it to me. Exodus 22:31 And ye shall be
holy men to me; and ye shall not eat flesh taken of beasts, ye shall
cast it to the dog.
In other words, what belongs to God should not be given to dogs. Therefore do not despise your brother and "toss him to the dogs".
Wild dogs were the object of fear and loathing:
http://jewishencyclopedia.com/articles/5255-dog
But "God hath charms to soothe the savage beast":
Exo 11:7 But not a dog shall growl against any of the people of
Israel, either man or beast, that you may know that the LORD makes a
distinction between Egypt and Israel.'
For his friendly conduct at the exodus of the Hebrews when he did not
"move his tongue against man or beast" (Ex. xi. 7), God compensated
the dog by telling the people that the meat forbidden to them should
be cast unto him (Mek., Mishpaṭim, 20, on Ex. xxii. 30).
Pearls (which mostly came from India) were extremely valuable:
Mat 13:45 "Again, the kingdom of heaven is like a merchant in search
of fine pearls, Mat 13:46 who, on finding one pearl of great value,
went and sold all that he had and bought it.
But wisdom is worth infinitely more:
Job 28:12 "But where shall wisdom be found? And where is the place of
understanding? Job 28:13 Man does not know its worth, and it is not
found in the land of the living. Job 28:14 The deep says, 'It is not
in me,' and the sea says, 'It is not with me.' Job 28:15 It cannot
be bought for gold, and silver cannot be weighed as its price. Job
28:16 It cannot be valued in the gold of Ophir, in precious onyx or
sapphire. Job 28:17 Gold and glass cannot equal it, nor can it be
exchanged for jewels of fine gold. Job 28:18 No mention shall be
made of coral or of crystal; the price of wisdom is above pearls. Job
28:19 The topaz of Ethiopia cannot equal it, nor can it be valued in
pure gold.
So to take the wisdom of God and to treat it like an unholy thing and cast it to pigs, who cannot possibly appreciate it is a travesty. They will merely trample it under their feet.
Dogs, crazed by the taste of holy flesh will return to eat you!
There seems to be an allusion to this passage in Galatians:
Gal 5:14 For the whole law is fulfilled in one word: "You shall love
your neighbor as yourself." Gal 5:15 But if you bite and devour one
another, watch out that you are not consumed by one another.