A gizzard, or "gastric mill", is a part of the stomach which grinds food. Animals which have grinding teeth do not need a gizzard, but there are many animals which do have one.
Gizzards are standard equipment for pterosaurs and birds, dinosaurs, and crocodilia, also many fish, and crustacea.
Gizzards work because the animal eats some gravel and small stones, and they grind against the food in the gizzard. Gizzards are muscular, and lined with tough material.
In birds, it works like this. Birds swallow food and store it in their crop if necessary. Then the food passes into their stomach, the stomach acid is added here to the food. Then the food passes into the gizzard (also known as the muscular stomach or ventriculus). The gizzard can grind the food with previously swallowed stones and pass it back to the true stomach, and vice versa. In simple terms, the gizzard 'chews' the food for the bird as it does not have teeth. Bird gizzards are lined with a tough layer made of the carbohydrate-protein complex koilin, to protect the muscles in the gizzard.
In birds the stomach is before the gizzard, but in grasshoppers the gizzard comes before the stomach. In earthworms there is only a gizzard, and no stomach.