As discussed in the comment you want to use pygmentize. A solution with listings is provided here: highlight lines in listings
The package minted and verbments are using the parser pygmentize (see: minted vs. texments vs. verbments). I am using verbments here. Both packages require the package fancyvrb to print the contents. So you can manipulate some commands of fancyvrb without influencing the output of pygmentize.
In the example below I provide two new keys:
bgrlinenbr - accepts a comma list representing the line numbers. These lines will be highlighted by the given color of bgrlineclr
bgrlineclr - defines the background color of the highlighted line.
Here the result and code:

\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage{beramono}
\usepackage{xparse}
\usepackage{verbments}
\makeatletter
\def\highlightedlines{}
\def\highlightedcolor{white}
\define@cmdkey{pyglist}[pl@]{bgrlinenbr}{\def\highlightedlines{#1}}%number
\define@cmdkey{pyglist}[pl@]{bgrlineclr}{\def\highlightedcolor{#1}}%color
\makeatother
\ExplSyntaxOn
\DeclareDocumentCommand \FancyVerbFormatLine { m }
{
\clist_if_in:NVTF \highlightedlines { \the\value{FancyVerbLine} }
{
\colorbox{\highlightedcolor}{#1}
}
{
#1
}
}
\ExplSyntaxOff
\begin{document}
Test
\begin{pyglist}[language=c,numbers=right,bgrlinenbr={1,2,4},bgrlineclr=red!20]
/**
* Prints Hello World.
**/
#include <stdio.h>
int main(void) {
printf("Hello World!");
return 0;
}
\end{pyglist}
\end{document}