In Batman vs Superman, Batman tells Alfred that
Doomsday is Kryptonian,
so he can be defeated with the kryptonite spear. How does Batman know that
Doomsday is Kryptonian?
It seems to be a combination of things that lead to this realization: First, he knew the Kryptonian ship drained power from the city (as told to him by Lois Lane right after his fight with Superman). Then he learned from Alfred that there was a creature wreaking havoc in Metropolis. But from the timing of his realization, it appears the final clue was that Doomsday had the ability to shoot lasers from his eyes, an ability that only the Kryptonians (Superman and Zod) had ever demonstrated. Right after being shot at by Doomsday he seems to suddenly put it all together - because that's when he thinks out loud to Alfred that it's Kryptonian and he must go back to Gotham for the spear - if he had already deduced it earlier he would have immediately headed for Gotham before approaching Doomsday.
During the movie, they know that Doomsday is actually General Zod. Since everyone knows Superman is Kryptonian it makes sense that Batman would know that Doomsday's weakness is also Kyrptonite.
Ancient Kryptonian deformity. The blood of my blood. Born to destroy you. Your Doomsday. Now God is good... as dead.
On top of that, Batman as a great detective knows,
Keep in mind that Batman had a copy of Luthor's computer data. This included not only his information on meta-humans, but presumably also his data on the Kryptonian ship and General Zod's body. At the time of Doomsday's appearance, Batman knew the following:
REPORTER: This thing emerged from the Kryptonian crash site just moments ago.
Given Batman's skills at deductive reasoning, it's not unreasonable to assume that he could connect these facts with the sudden appearance of the monster from an otherwise dormant ship. Here's the scene you're referencing, where Batman announces Doomsday is Kryptonian. It's immediately after the monster fires his heat vision at the Batwing when Batman makes the connection:
BATMAN: Alfred. It's Kryptonian... only Kryptonite weapons can kill it.
ALFRED: It might, if you have any left.
BATMAN: [checking on the weapons] I've only got one round left. Wait... the spear. Alfred, the spear! It's pure kryptonite. It's back in Gotham. If I can penetrate the skin, the spear will kill it.