Montag has to memorize Ecclesiastes and Revelation because they are the most symbolic books in the Bible in relation to this novel. Ecclesiastes is symbolic because its title means "to gather." Granger, Montag, and The Book People at the end must all gather. They have become human books. Once they gather, the can scribe the memorized books into a full text--in this case, the Bible. Also, Ecclesiastes is symbolic to the fire/light imagery in the novel. One translation, according to Wikipedia, of the book is
to state "that all is futile under the Sun. One should therefore ignore physical pleasures and put all one's efforts towards that which is above the Sun. This is summed up in the second to last verse: "The end of the matter; all has been heard. Fear God, and keep his commandments; for that is the whole duty of everyone" (12:13).
All is futile under censorship. One must pull one's efforts toward keeping the "commandments" (books). That is the whole duty of the Book People.
Revelation is symbolic because it is the last book of the Bible, and it is about a post-apocolyptic vision of the future, much like the dystopian novel F451. The world of censorship has come to an end, and now man--and his relationship to books--must move towards a new beginning. Revelation depicts the Second Coming, and Montag seems to be a kind of prophet, like Paul--who spread Christianity--through letters--after Christ's death.
The final two paragraphs are as follows:
And on either side of the river was there a tree of life, which bare twelve manner of fruits, and yielded her fruit every month; And the leaves of the tree were for the healing of the nations. Yes, thought Montag, that's the one I'll save for noon. For noon...When we reach the city.
The tree of life is akin to the tree of knowledge of good and evil in the creation story of Genesis. The 12 fruits alludes to the Twelve Tribes of Israel in the Old Testament. The novel ends with Pheonix imagery, that the Book People will be like the Jews wandering toward the Promised Land. Only then will the world be reborn once books have saved.