It depends. Isn't that a fun answer?
I was an undergraduate in CS who went the research route(even over traditional internships). I ended up in a great environment where I had a ton of freedom, guidance and ended up with some excellent references and citations. I had two papers published as first author, my name on the acknowledgements of a couple other papers and, even as I move beyond school and into industry work, I am involved in several other follow-up papers on my research.
For me research was invaluable. It is expected, in the US, for almost all CS students to have internships. So much so that unless you get into a very competitive internship it's hard to stand out. Having research experience makes you stand out. Being able to say, in an interview, "In the paper for conference XXX I wrote YYY" definitely makes companies take notice. It is important, of course, that you take care with research.
Doing grunt work, while part of any research and something you will not avoid, isn't very impressive. You'll have to do some and quite a few PIs will give you grunt work to gauge whether or not you will have the gumption and tenacity to stick around. Plus, as mentioned, grunt work is part of research sometimes. Take the time and talk about the project(s) you would be involved in, see what your place in the research would be. A project where you run tons of experiments but do not make changes, steer the research, evaluate the results is not going to be as impressive or as valuable as a research experience in which you see all aspects of research.
Additionally, no one ever says this, but research papers are a bane on the existence of mankind. Ok, well... maybe just the ones I've been involved in. As a first author in a small research team you will be writing most of the paper. As a lower level contributor to a larger project your writing duties will probably be minimal. Find this out early. There's more glory in being one of the first authors/coauthors but there is a lot more work. With a heavy course load, a research paper is not a lot of fun. My first research paper had me getting fewer than 3 hours a night of sleep for two weeks AND pulling all-nighters for the days leading up to the submission. Academic writing is challenging and has a learning curve. Be upfront with what you can do and be aware of your commitment to the project.
Other answers have said that you don't learn a language well/deeply or use the newest and latest tools/toys in research and that really depends on the field in which you study. In Artificial Intelligence and Robotics(the field I was involved in) I ended up with a fantastic functional understanding of the languages we used. Good research code not only has to work but it has to work reliably and quickly. There's no guarantee that the code you write on a personal project will be great. The greatness of your code(cleanliness etc) depends on your internal standards - both in research and in a personal project. Additionally, in my case, I was able to learn to write code for and run code on one of the biggest super computers in the US. That is a shiny toy. I got to propose new technologies to use and often the code I was using was in the 'bleeding edge' branches of the git repositories because I needed untested functionality. So, to that, I say "eh, it depends". I know some groups that are stuck in the stone ages when it comes to code, tools and work but I know just as many who are on the bleeding edge and, in my experience, it was pretty darn cool.