This is even easier than a recipe. The code can be added to init or preInit. (Note: In Forge 1.7, they recommend using putting recipes in preInit rather than init.)
You specify an input, an output and experience. The input and output are both an ItemStack with either a single item or you can specify how many items, as in recipes. Experience is a number between 0 and 1. In Java, we use a float (short floating-point number) to represent most decimal numbers, so 0.1f means a float with value 0.1.
(Thanks to Luke for this code.)