Related to What did Rey tell Teedo that caused him to release BB-8? - Rey approaches Teedo and intimidated him as if he captured a sentient being. Are all droids afforded a status that gives them rights even when lost or away from their masters/owners?
TL;DR: Because he is sentient.
I will be using some quotes from the novelization of The Force Awakens, which describe BB-8 and his behavior, to support my case (because I happen to have it handy at the moment).
BB-8's dialogue (i.e., beeping) as a reflection of his emotions and sentience:
BB-8's beeps are variously described as:
BB-8's behavior and thoughts as a reflection of his emotions and sentience:
His reactions to different situations are similarly varied, and highly suggestive of an advanced level of consciousness:
We even get a glimpse of how he feels about humans and other organic beings:
And at one point he seeks out his own kind; he is well aware that he was a droid, and not a human:
He himself is described as:
The scene with the Teedo:
The Teedo presumably didn't care about legal ownership of BB-8, and just wanted some money. Droids are generally treated as property in the galaxy far, far away, although the good guys treat them like sentient property. They may not have full rights, and I assume a droid's owner can do whatever he or she wants with it, but the heroes generally try to strike a balance between taking a droid's feelings into consideration while also making use of the droid.
Rey seemed to be acting out of compassion, perhaps because she herself is often treated badly; she also deemed the Teedo's behavior as "particularly impolite", and said he "wanted [BB-8] for parts". She may have assumed that BB-8 was on an errand for his owner, and that the Teedo was breaking some sort of unspoken code of scavenging.
I assume that, had the Teedo stolen BB-8 and scrapped him for parts, he would be guilty of theft, destruction of property, etc, but not murder.
As should be clear by now, BB-8 is definitely self aware, and possesses sentience/consciousness, albeit "artificial consciousness". He fears for his well-being and the well-being of his friends, he gets annoyed, he is insubordinate, he gets frustrated, he experiences sadness, loyalty, comradeship, happiness, and doubt.
He doesn't feel these emotions and impulses in a vacuum, of course - he acts in accordance to them, and makes decisions based on them. For example, when he sees Finn wearing a jacket that belongs to his master Poe, he alerts Rey to the apparent theft (despite the fact that Rey has no real reason to care, from a perspective of pure self-interest), and after she knocks Finn down, BB-8 makes it abundantly clear that he is enraged by Finn's apparent thievery, and repeatedly shocks him with a Taser. When Finn explains that he came to Jakku with Poe, but believed the latter to be dead, BB-8 reacts appropriately, immediately foregoing his rage and sinking into grief and despair.
He is more limited in his actions than we are: He apparently can't reject a direct order, no matter how much he wants to do so, but can only protest it. His programming inhibits him in less direct ways as well - at one point, he follows Rey, staying "as close to her as protocol allowed". This suggests that he is programmed with a complex set of guidelines, presumably designed to accommodate basic etiquette, including, perhaps, some respect for "personal space".
More to the point of the question - which focuses on sentience - he knows he is a droid, and wants to be among his own kind, but sees humans as an acceptable substitute - even if he can't "rouse much empathy" for the human need to eat, despite understanding it in an objective sense.
Regardless of the mechanical and artificial source of his sentience, he clearly possesses a wide range of emotions, fears, hopes, desires, and opinions, and these are quite similar to their analogues in humans and other intelligent species. This isn't mere parroting of what he sees, it is intuitive, natural, and authentic. He doesn't just appear to be a thinking, feeling, self-aware entity; he truly does think, feel, and possess a robust awareness of himself.
Although BB-8 would presumably have to obey Poe even if he didn't like him, this clearly isn't the case - BB-8 is not only obedient, but loyal and affectionate. He obviously cares for Poe, and later, Rey and Finn, quite deeply. I don't see any evidence that his affection for his organic companions is substantially different from their affection for one another. And although I haven't touched on it elsewhere in this answer, it is self-evident, in my opinion, that the same is true of R2-D2. The most prominent droids in Star Wars are quite plainly sentient, emotional beings who love their companions and display a full range of emotions throughout the series.
Thus, many droids, including BB-8, obviously do possess sentience, self-awareness, emotions, and personalities, and although some aspects of their behavior are regulated by programming and fairly rigid protocol, these limitations and prohibitions seem to be a very minor part of the overall picture. The vast majority of a droid's actions are motivated by internal decision making processes, emotions, and values, in a manner that appears to be almost indistinguishable from our own decision making processes, emotions, and values.
As someone who's quite literally on the bottom rung of society (doing work that's almost too low value to waste a droid on) Rey sees BB-8 as a kindred spirit.