(Exodus 13:1-2) "And the LORD spoke to Moses, saying: Consecrate to Me every firstborn." This is one of the hermeneutical principles by which the Torah is expounded: a general statement that requires a particular, and a particular that requires a general. "Consecrate to Me every firstborn" is a general statement; both males and females are implied, as it is said, "Every firstborn that is born…" (Deuteronomy 15:19). "The male" is the particular; females are excluded. From the implication, I might read the general statement — so what does the particular come to teach? For if I read the general statement but not the particular, I would understand that whatever is born first, whether male or female, would be a firstborn. Therefore Scripture teaches, "Every firstborn… the male" — males but not females. And if I read the particular but not the general statement, I would understand that any male that is born, whether it opens the womb or does not open the womb, would be a firstborn. Therefore Scripture teaches, "Consecrate to Me every firstborn" — until it is both male and opening the womb, to fulfill what is said, "Every one that opens the womb" (Exodus 13:12). Rabbi Ishmael says: one verse says "you shall sanctify" (Deuteronomy 15:19), and another verse says "he shall not sanctify" (Leviticus 27:26). You may sanctify it with a sanctification of valuation, but you may not sanctify it with a sanctification for the altar. "Among man and among beast" — that which applies to man applies to beast; the Levites are excluded, for since they have no firstborn obligation among man, they have none among beast.
Consecrate the Firstborn and the Rule of General and Particular
Yalkut Shimoni on Torah 214:1
(שמות יג א-ב) וַיְדַבֵּר ה' אֶל מֹשֶׁה לֵּאמֹר קַדֶּשׁ לִי כָל בְּכוֹר. זוּ אַחַת מִן הַמִּדּוֹת שֶׁהַתּוֹרָה נִדְרֶשֶׁת בָּהֶם, כְּלָל שֶׁהוּא צָרִיךְ לִפְרָט, וּפְרָט שֶׁהוּא צָרִיךְ לִכְלָל, קַדֶּשׁ לִי כָל בְּכוֹר, כְּלָל, אֶחָד זְכָרִים וְאֶחָד נְקֵבוֹת בְּמַשְׁמַע, שֶׁנֶּאֱמַר (דברים טו, יט) "כָּל הַבְּכוֹר אֲשֶׁר יִוָּלֵד" וְגוֹ'. "הַזָּכָר", פְּרָט, יָצְאוּ נְקֵבוֹת, מִמַּשְׁמָע אֲנִי אֶקְרָא אֶת הַכְּלָל וּמַה תַּלְמוּד לוֹמַר הַפְּרָט, שֶׁאִם קוֹרֵא אֲנִי אֶת הַכְּלָל אֲבָל לֹא אֶת הַפְּרָט שׁוֹמֵעַ אֲנִי כָּל שֶׁיִּוָּלֵד רִאשׁוֹן בֵּין זָכָר בֵּין נְקֵבָה יִהְיֶה בְּכוֹר (וְכוּ'), תַּלְמוּד לוֹמַר "כָּל הַבְּכוֹר וְגוֹ'. הַזָּכָר", זְכָרִים אֲבָל לֹא נְקֵבוֹת. אֲנִי אֶקְרָא אֶת הַפְּרָט אֲבָל לֹא אֶת הַכְּלָל, שׁוֹמֵעַ אֲנִי כָּל זָכָר שֶׁיִּוָּלֵד בֵּין כְּשֶׁהוּא פּוֹתֵחַ רֶחֶם וּבֵין שֶׁאֵינוֹ פּוֹתֵחַ רֶחֶם יִהְיֶה בְּכוֹר, תַּלְמוּד לוֹמַר קַדֶּשׁ לִי כָל בְּכוֹר, עַד שֶׁיִּהְיֶה זָכָר וּפוֹתֵחַ רֶחֶם, לְקַיֵּם מַה שֶׁנֶּאֱמַר "כָּל פֶּטֶר רֶחֶם" וְגוֹ'. רַבִּי יִשְׁמָעֵאל אוֹמֵר, כָּתוּב אֶחָד אוֹמֵר (דברים טו, יט) "תַּקְדִּישׁ" וְכָתוּב אַחֵר אוֹמֵר "לֹא יַקְדִּישׁ". מַקְדִּישׁוֹ אַתָּה הֶקְדֵּשׁ עִלּוּי וְאֵין אַתָּה מַקְדִּישׁוֹ הֶקְדֵּשׁ מִזְבֵּחַ. בָּאָדָם וּבַבְּהֵמָה. אֶת שֶׁיֵּשׁ לוֹ בָּאָדָם יֵשׁ לוֹ בַּבְּהֵמָה, יָצְאוּ הַלְּוִיִּים שֶׁאֵין לָהֶם בָּאָדָם, לֹא יִהְיֶה לָהֶם בַּבְּהֵמָה.