GridFS is MongoDB's solution for storing binary data in the database. It is a specification for handling large files in MongoDB. When I say specification, I mean it is not a feature of MongoDB itself; there is no code in MongoDB that implements it. GridFS just specifies how large files are to be handled in the database, and the language drivers (PHP, Python, Ruby, and so on) implement this specification and expose an API to the user of that driver (that's you) so you can use it to store/retrieve large files in MongoDB.
By design, a MongoDB document (a BSON object) cannot be larger than 16 megabytes. This is to keep performance at an optimum level. If there are documents larger than 16 MB, they are going to take up a lot of memory when you query them. GridFS specifies a mechanism for dividing a large file among multiple documents. The language driver that implements it, for example, the PHP driver, takes care of the splitting of the stored files...