Broad definition
There are finer points to the subjective "feels right" when it comes to particular points like distance to the trigger and controls, how it affects the pointing / grip angle of the gun but those are preferences that you'll discover (if you keep an eye out) as you start shooting more.
When I try on new grips or heft a new gun I take notice of grip size.
Specifically - how much finger strength does it take to simply hold the gun up to eye level and operate?
If the grips are too large for your hand size your fingers are more extended and beyond a certain point you'll have less control of the firearm during recoil, when shooting one-handed, or during a struggle.
For example, let's say someone can "palm" a basketball and hold it still with one hand. Fine. I might be able to do that but every finger is squeezing just to keep the ball from dropping. Now let's add some controls to that basketball- can I reach them while trying to hold it? No. A baseball sized object would do much better.
A grip too small for my hand isn't going to "feel good" either. If we continue our analogy - it would be difficult to hold a Ping Pong ball securely and manipulate controls on it. I would have "more finger" than I knew what to do with. Like using a remote control, cell phone, or iPod that's just way too small.
So with regards to size - if you relax your grip moderately, does the pistol feel like it will fall out of your hand? On the other side of the spectrum there are pistols that are very small like the Keltec P3AT, LCP, J-frame revolvers - and typically require an adjustment in technique or other grips to obtain optimal grip size for accurate shooting. Most who have these (I have a j-frame) however like how concealable they are and accept the trade-off.
Shape and Texture - is usually a factor when someone says "it feels good in the hand". Some like a hump in the backstrap (the rearward part of the grip that faces the shooter) to contact their palm. Some hate that and like a flat backstrap instead. Some guns have grips that are shaped more rectangularly or more like the cross section of an oval. A lot of those issues depend on your hand / finger / palm size. The grip shape can affect the grip angle which people may have developed a preference for. Ever see in the movies those old single shot black powder pistols that are so straight they look like a curved stick rather than anything with a "grip"? Like those, some handguns have a steeper grip angle than others. And some grips with those humps on the backstrap or palmswells on the sides can affect the distance your finger has to reach to the trigger.
Texture - this one's tricky because sometimes what is comfortable here may not be what helps us shoot best. Silk would be pleasing to feel but not really offer any grip. Some checkering / stippling / grooves in the grip can be too severe and discourage someone from practicing or irritate the hand. Older service revolvers came with these beautiful wooden grips that were aggressively textured - nicknamed "cheese graters" that many dumped immediately for rubber grips. But having some sort of texture does help - even if it's not a built in bump or groove but just the roughness of the finish (parkerizing) in the metal. Some people like finger grooves built into their gun - others find that the grooves don't match up with where they naturally place their fingers. Some people purchase grip tape and aftermarket grips later on as a little enhancement. To me, texturing is less important than grip size/shape because it can be easily modified without altering the handgun itself.
The newer a person is to shooting, the more open their options are as far as not being "used to" a certain grip angle or shape. And those issues that relate to hand size and finger length can be adapted to with changes in technique - up to a certain point and depending on what type of shooting you're doing. I like to ponder the biomechanics involved but the good news is that here is a test to see if all of the above work for you with a given gun WITHOUT having to understand them: Find a place with rentals and rent several different handguns of the same caliber (if semi-auto I recommend 9mm, if revolver try 38 special). See which you shoot best with and if "comfort" does in the case of that handgun help you shoot best. Note what you like about that handgun.
I once read some advice arguing for moderately priced handguns as a first gun rather than the most expensive ones. It's a relative scale yes, but here was the reasoning. At first you haven't had the chance to learn what works or doesn't work for you in a handgun. You've had your hand your whole life but haven't observed how it interacts best with a gun. So feel free to pick a "decent" gun and learn what you like and more importantly what you don't like about it and should you choose to spring for a fancier one you'll know exactly what you're looking for. This is preferable to buying the most expensive of a given type of handgun and then finding you don't like a lot of things about it. Basically, anyone's first gun won't be "perfect" for them (there is no perfect gun actually) so focus less on the pressure of choosing the perfect one. Plus, it likely won't be your last gun.
And while we're on the topic of having a less expensive gun handy - you're learning gun handling / maintenance / disassembly etc... you may scratch or break parts as you learn. And if you ever introduce someone new to shooting it may be better to let them use the "beater" rather than your gold-plated bundle of joy.
That's what I think "feels good in hand" means to some extent. Hope this helps and I think you'll have lots of fun with your new hobby.