It is definitely possible to "break" a finger nail. However this does not happen very frequently. Nails are made up of a protein called keratin that can be very tough, but also maintains a level of flexibility to it. There is something called the matrix unguis which is a layer of tissue (germinal matrix) on which the nail root (the part of the nail underneath the skin where new cells are made) sits. Deep to the matrix unguis are many nerve fibers, and a vascular bed that provides nutrient blood flow to the growing nail cells. The "nail" that most people refer to (and women paint, etc) is actually many layers of dead cells mainly composed of keratin. What this all means in your case is that my best guess is that is there is no obvious hematoma, or bruising, underneath the nail bed, then the baseball hit part of your nail bending it backwards and causing a crease (white line) rather than actually fracturing the nail. This will disrupt or put pressure on the nerve fibers underneath and be very painful. The only way to tell for sure if this is what happened, would be to get your finger examined. Pain could also mean that there is a small fracture
in a bone as well, so I would recommend getting it checked out by your general practitioner. Good luck.